﻿<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="TSFacadeSettings"
    targetNamespace="http://tsfacade.codeplex.com/TSFacadeSettings.xsd"
    elementFormDefault="qualified"
    xmlns="http://tsfacade.codeplex.com/TSFacadeSettings.xsd"
    xmlns:mstns="http://tsfacade.codeplex.com/TSFacadeSettings.xsd"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
>
	<xs:element name="TypeScriptFacadeSettings" type="TypeScriptFacadeSettings" />

	<xs:complexType name="TypeScriptFacadeSettings">
		<xs:annotation>
			<xs:documentation>Settings for TypeScriptFacade</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="ServiceFacadeName" type="xs:string" maxOccurs="1" minOccurs="1" default="ServiceFacade">
				<xs:annotation>
					<xs:documentation>The namespace to apply to the generated service facade (default ServiceFacade)</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="ServiceProvider" type="ServiceProviderEnumeration" default="AspNetWebService" minOccurs="0" maxOccurs="1" />
			<xs:element name="DefaultDomainRelativeServiceUrl" type="xs:string" maxOccurs="1" minOccurs="0" default="">
				<xs:annotation>
					<xs:documentation>Relative to the domain, the URL under which the services exist</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="ChangeTracking" type="TypeScriptFacadeChangeTracking" maxOccurs="1" minOccurs="1" />
			<xs:element name="Exclusions" type="TypeScriptFacadeExclusions" maxOccurs="1" minOccurs="0" />
			<xs:element name="TreatAsAny" type="TypeScriptFacadeAnys" maxOccurs="1" minOccurs="0" />
		</xs:sequence>
	</xs:complexType>

	<xs:simpleType name="ServiceProviderEnumeration">
		<xs:annotation>
			<xs:documentation>Possible service frameworks to provide a facade for</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:enumeration value="AspNetWebService">
				<xs:annotation>
					<xs:documentation>ASP.NET Web Services (.asmx)</xs:documentation>
				</xs:annotation>
			</xs:enumeration>
			<xs:enumeration value="WcfWebService">
				<xs:annotation>
					<xs:documentation>WCF Web Service (.svc)</xs:documentation>
				</xs:annotation>
			</xs:enumeration>
		</xs:restriction>
	</xs:simpleType>

	<xs:complexType name="TypeScriptFacadeChangeTracking">
		<xs:annotation>
			<xs:documentation>Settings for change tracking in generated classes</xs:documentation>
		</xs:annotation>
		<xs:attribute name="Enabled" use="required" type="xs:boolean">
			<xs:annotation>
				<xs:documentation>Indicates whether change tracking boilerplate code should be included in the generated TypeScript classes. Default: true</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="AutoSnapshotReturnedObjects" use="optional" type="xs:boolean" default="false">
			<xs:annotation>
				<xs:documentation>Indicates whether objects should automatically have their state saved when returned from the service facade. Note this will not snapshot objects passed as parameters to the service facade. Default: false</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="SnapshotMethodName" type="xs:string" use="optional" default="snapshot">
			<xs:annotation>
				<xs:documentation>When change tracking is enabled, snapshot() can be called on objects to save the current state of the object. This state will be compared to the current state by the hasChanges() method. Default: snapshot</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="HasChangesMethodName" type="xs:string" use="optional" default="hasChanges">
			<xs:annotation>
				<xs:documentation>When change tracking is enabled, hasChanges() can be called on objects to compare the current state of the object with the state stored in the last snapshot. Default: hasChanges</xs:documentation>
			</xs:annotation>
		</xs:attribute>
    <xs:attribute name="RevertMethodName" type="xs:string" use="optional" default="revert">
      <xs:annotation>
        <xs:documentation>When change tracking is enabled, revert() can be called on objects to return them to the state they were in when snapshot() was last called. Default: revert</xs:documentation>
      </xs:annotation>
    </xs:attribute>
	</xs:complexType>

	<xs:complexType name="TypeScriptFacadeExclusions">
		<xs:annotation>
			<xs:documentation>Lists the full names (including namespace) of service classes to exclude from the facade generation</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="Exclusion" type="xs:string" minOccurs="0" maxOccurs="unbounded">
				<xs:annotation>
					<xs:documentation>The full name (including namespace) of a service class you wish to exclude from the service facade</xs:documentation>
				</xs:annotation>
			</xs:element>
		</xs:sequence>
	</xs:complexType>

	<xs:complexType name="TypeScriptFacadeAnys">
		<xs:annotation>
			<xs:documentation>Regular expressions which, when a type's full name matches the regular expression, will cause the type to be treated as 'any'</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="Any" type="xs:string" minOccurs="0" maxOccurs="unbounded">
				<xs:annotation>
					<xs:documentation>The full name (including namespace) of the DataContract class you want to treat as 'any'</xs:documentation>
				</xs:annotation>
			</xs:element>
		</xs:sequence>
	</xs:complexType>

</xs:schema>